package com.jibei.mendo.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import com.jibei.mendo.bean.ConfigInfoBeanDao;
import com.jibei.mendo.bean.DaoMaster;
import com.jibei.mendo.bean.IgnitionInfoBeanDao;


/**
 * Created by lhl on 2018-07-05
 */
public class UpgradeHelper extends DaoMaster.OpenHelper {

    public UpgradeHelper(Context context, String name) {
        super(context, name);
    }

    public UpgradeHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        //        super.onUpgrade(db, oldVersion, newVersion);

        Log.i("greenDAO_UpgradeHelper", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by migrating all tables data");

        MigrationHelper.migrate(db,
                ConfigInfoBeanDao.class,
                IgnitionInfoBeanDao.class);
    }

}
